|
''"Everything is a file"'' describes one of the defining features of Unix, and its derivatives — that a wide range of input/output resources such as documents, directories, hard-drives, modems, keyboards, printers and even some inter-process and network communications are simple streams of bytes exposed through the filesystem name space.〔() 〕 The advantage of this approach is that the same set of tools, utilities and APIs can be used on a wide range of resources. There are a number of file types. When a file is opened a file descriptor is created. The file path becoming the addressing system and the file descriptor being the byte stream I/O interface. But file descriptors are also created for things like anonymous pipes and network sockets via different methods. So it is more accurate to say ''"Everything is a file descriptor"''.〔(【引用サイトリンク】url=http://yarchive.net/comp/linux/everything_is_file.html )〕〔(【引用サイトリンク】url=http://lwn.net/Articles/411845/ )〕 Additionally, a range of pseudo and virtual filesystems exists which exposes information about processes and other system information in a hierarchical file-like structure. These are mounted into the single file hierarchy. An example of this purely virtual filesystem is under /proc that exposes many system properties as files. All of these "files" have standard Unix file attributes such as an owner and access permissions, and can be queried by the same classic Unix tools and filters. However, this is not universally considered a fast or portable approach. Some operating systems do not even mount /proc by default due to security or speed concerns. The Linux world uses it heavily though. By both the widely installed BusyBox on embedded systems and by procps, which is used on most GNU/Linux systems. In both cases it is used in implementations of process related POSIX shell commands. It is similarly used on Android system in its Toolbox program. Unix's successor Plan 9 took this concept into distributed computing with the 9P protocol. ==See also== * Device file * Unix architecture * Synthetic file system 抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)』 ■ウィキペディアで「Everything is a file」の詳細全文を読む スポンサード リンク
|